package cn.usian.product.controller;

import cn.usian.jyzx.model.entity.product.Category;
import cn.usian.jyzx.model.vo.common.Result;
import cn.usian.jyzx.model.vo.common.ResultCodeEnum;
import cn.usian.product.service.CategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping(value ="/api/product/category")
public class CategoryController {

    @Autowired
    private CategoryService categoryService;

    @GetMapping("findCategoryTree")
    public Result<List<Category>> findCategoryTree()
    {
        return Result.build(categoryService.findCategoryTree(), ResultCodeEnum.SUCCESS);
    }
}
